import java.util.*;
public class Ramdom {

    public static void main(String[] args) {
        String[]  ad = {"侍世涛","朱光宁","陈奕扬","小豆","小米","小菜","小于","当当","高峰","黄瓜"};//定义字符数组
        /*
        遍历数组，输出所有学生姓名
         */
        System.out.println("学生列表为：");
        for(int i=0;i<ad.length;i++){
            System.out.print( ad[i]+" ");
        }
        System.out.println();
        Random a = new Random();
        int b = a.nextInt(ad.length);   //生成随机数
        System.out.println("随机抽到的学生为:"+ad[b]);//输出随机数对应的字符数组的索引位置的字符
    }

    public static void main(String[] args) {
        String[]  ad = {"侍世涛","朱光宁","陈奕扬","小豆","小米","小菜","小于","当当","高峰","黄瓜"};//定义字符数组
        /*
        遍历数组，输出所有学生姓名
         */
        System.out.println("学生列表为：");
        for(int i=0;i<ad.length;i++){
            System.out.print( ad[i]+" ");
        }
        System.out.println();
        Random a = new Random();
        int b = a.nextInt(ad.length);   //生成随机数
        System.out.println("随机抽到的学生为:"+ad[b]);//输出随机数对应的字符数组的索引位置的字符
    }
}

